<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="js/ajaxfunction.js" type="text/javascript"></script>
<script language="javascript">
	function ktra()
	{
		if(document.login.user.value=='')
		{
			alert('Xin vui lòng nhập Username!');
			document.login.user.focus();
			return false;
		}
		else if(document.login.pass.value=='')
		{
			alert('Xin vui lòng nhập Password!');
			document.login.pass.focus();
			return false;
		}
		else
			return true;
	}
</script>
<title>Untitled Document</title>
</head>
<body>
<?php
	if(isset($_REQUEST['logout']))
	{
	   session_destroy();
	   echo "<meta http-equiv='refresh' content='0;url=administrator.php' />";
	}
	else if(isset($_SESSION['admin']))
	{
		echo "Bạn đã đăng nhập vào hệ thống rồi!";
		echo "<meta http-equiv='refresh' content='2;url=home_admin.php' />";
	}
	else
	{
?>
<div style="width:410px; margin:100px auto;"><fieldset  style="-moz-border-radius: 7px;">
  <legend></legend>
 <form id="form1" name="login" method="post" action="admin/xulyloginadmin.php" onsubmit="return ktra();">
 <div style=" width:400px;text-align:center; color:#0033CC; font-size:27px; height:40px; font:Arial; font-weight:bold">Đăng nhập Quản trị</div>
  <table width="400px" border="0" align="center">
  <tr>
    <td ><label>
      <input type="image" name="imageField" src="images/key_big_m.png" />
    </label></td>
    <td valign="top">
	<table width="100%" border="0" >
    <tr>
      <td width="44%">Username</td>
      <td width="28%"><label>
        <input type="text" name="user" />
      </label></td>
      <td width="28%"><img src="images/person_icon.png" width="27" height="27" /></td>
    </tr>
    <tr>
      <td>Password</td>
      <td><label>
        <input type="password" name="pass" />
      </label></td>
      <td><img src="images/key.png" width="20" height="27" /></td>
    </tr>
    <tr>
      <td colspan="3" style="text-align:center"><input type="hidden" name="xacnhan" value="0" />
      <input class="button" type="submit" name="Submit" value="Đăng Nhập" />
        <input class="button" type="button" name="Submit2" value="Hủy" /></td>
    </tr>
  </table></td>
  </tr>
</table>
</form>
  </fieldset>
</div>
<?php
	}
?>
</body>
</html>
